#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/9/20 17:24
# @Author  : AshJo
# @Desc    : 圆形与圆环
# @Filename: Circle.py
# @Version : v1.0
"""

from math import pi


class Circle:
    def __init__(self, radius):
        self.radius = radius

    def area(self):
        return pi * (self.radius ** 2)

    def perimeter(self):
        return 2 * pi * self.radius


class Ring:
    def __init__(self, outer_radius, inner_radius):
        outer_radius, inner_radius = (outer_radius, inner_radius) if outer_radius > inner_radius else (
        inner_radius, outer_radius)
        self.out_c = Circle(outer_radius)
        self.in_c = Circle(inner_radius)

    def area(self):
        return self.out_c.area() - self.in_c.area()

    def perimeter(self):
        return self.out_c.perimeter() + self.in_c.perimeter()


if __name__ == '__main__':
    r = Ring(8, 10)
    print(r.area())
    print(r.perimeter())
